package com.codechenxi.study.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author codechenxi
 * @description
 * @since 2025-07-02 21:36
 */

@RestController
public class PopularIntegrationController {

    @Resource
    private ChatModel chatModel;

    // http://localhost:9003/langchain4j/boot/chat
    @GetMapping(value = "/langchain4j/boot/chat")
    public String chat(@RequestParam(value = "prompt", defaultValue = "你是谁") String prompt)
    {
        return chatModel.chat(prompt);
    }
}
